// JavaScript Document

// This function loads the image rotator in the header of each webpage.

/*
	Copyright 2011 Tobias Heinzer + Peter Affentranger

	This file is part of the website flugservice.ch.

    The website flugservice.ch is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    The website flugservice.ch is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with the website flugservice.ch.  If not, see <http://www.gnu.org/licenses/>.
*/

function loadImagerotator() {
	var images = new Array();
	images[0]  = { image: "/images/rotator/image50.jpg" };
	images[1]  = { image: "/images/rotator/image51.jpg" };
    images[2]  = { image: "/images/rotator/image40.jpg" };
    images[3]  = { image: "/images/rotator/image44.jpg" };
    images[4]  = { image: "/images/rotator/image09.jpg" };
    images[5]  = { image: "/images/rotator/image17.jpg" };
    images[6]  = { image: "/images/rotator/image08.jpg" };
    images[7]  = { image: "/images/rotator/image16.jpg" };
    images[8]  = { image: "/images/rotator/image26.jpg" };
    images[9]  = { image: "/images/rotator/image23.jpg" };
    images[10] = { image: "/images/rotator/image47.jpg" };
    images[11] = { image: "/images/rotator/image33.jpg" };
    images[12] = { image: "/images/rotator/image05.jpg" };
    images[13] = { image: "/images/rotator/image06.jpg" };
    images[14] = { image: "/images/rotator/image15.jpg" };
    images[15] = { image: "/images/rotator/image39.jpg" };
    images[16] = { image: "/images/rotator/image48.jpg" };
    images[17] = { image: "/images/rotator/image49.jpg" };

	images.sort(randOrd);

	$("#imagerotator").galleria({
        autoplay: 7000,
		dataSource: images,
        height: 154,
		imageCrop: true,
		imageMargin: 0,
		imagePan: true, 
		imagePosition: 'center center',
		showCounter: false,
		showImagenav: false,
		thumbnails: false,
		transition: 'fade',
		transitionSpeed: 1000
    });
}


function randOrd(){
	return (Math.round(Math.random())-0.5); 
}
